gtk-demo: Improve the entry completion demo
authorMatthias Clasen <mclasen@redhat.com>
Wed, 24 Jun 2020 02:39:16 +0000 (22:39 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 24 Jun 2020 17:02:50 +0000 (13:02 -0400)
Add more strings.

demos/gtk-demo/entry_completion.c

index 11ff063a42a76d128e02768ab1a55da229f6dbdb..a9949c2fc89e4377f04c4770fd96fca87f5c0ae8 100644 (file)
 static GtkTreeModel *
 create_completion_model (void)
 {
+  const char *strings[] = {
+    "GNOME",
+    "gnominious",
+    "Gnomonic projection",
+    "Gnosophy",
+    "total",
+    "totally",
+    "toto",
+    "tottery",
+    "totterer",
+    "Totten trust",
+    "Tottenham hotspurs",
+    "totipotent",
+    "totipotency",
+    "totemism",
+    "totem pole",
+    "Totara",
+    "totalizer",
+    "totalizator",
+    "totalitarianism",
+    "total parenteral nutrition",
+    "total eclipse",
+    "Totipresence",
+    "Totipalmi",
+    "zombie",
+    "aæx",
+    "aæy",
+    "aæz",
+    NULL
+  };
+  int i;
   GtkListStore *store;
   GtkTreeIter iter;
 
   store = gtk_list_store_new (1, G_TYPE_STRING);
 
-  /* Append one word */
-  gtk_list_store_append (store, &iter);
-  gtk_list_store_set (store, &iter, 0, "GNOME", -1);
-
-  /* Append another word */
-  gtk_list_store_append (store, &iter);
-  gtk_list_store_set (store, &iter, 0, "total", -1);
-
-  /* And another word */
-  gtk_list_store_append (store, &iter);
-  gtk_list_store_set (store, &iter, 0, "totally", -1);
+  for (i = 0; strings[i]; i++)
+    {
+      /* Append one word */
+      gtk_list_store_append (store, &iter);
+      gtk_list_store_set (store, &iter, 0, strings[i], -1);
+    }
 
   return GTK_TREE_MODEL (store);
 }